package models

import (
	"qld2devservice/utils"
	"time"
)

type QldChargeCabinet struct {
	AddBy          int64
	AddTime        time.Time
	AreaId         int64
	BoxNum         int
	CabinetSn      string
	ChargePriceDes string
	Col            int
	ControlId      int64
	Des            string
	ExtraId        int64
	Id             int `gorm:"primary_key"`
	Img            string
	Lat            float64
	Lng            float64
	OperateMode    int
	ProtocolId     int64
	RentPriceDes   string
	Row            int
	Type           int
}

func GetQldChargeCabinetsBySnNum(cabinetSn string) ([]QldChargeCabinet, error) {
	var qldChargeCabinets []QldChargeCabinet
	//条件查询
	err := DB.Where("cabinet_sn = ?", cabinetSn).Find(&qldChargeCabinets).Error
	if err != nil {
		newErr := utils.WrapError(err, "GetQldChargeCabinetsBySnNum:1,数据库获取设备失败,cabinetSn="+cabinetSn)
		utils.MyPrint(utils.PRINT_ERROR, newErr.Error())
		return []QldChargeCabinet{}, newErr
	}
	return qldChargeCabinets, nil
}
